import matplotlib.pyplot as plt
import pandas as pd
plt.rcParams['svg.fonttype'] = 'none'

# 创建数据框架
data = {
    'Node Nums': [40, 80, 120, 160, 200, 240, 280, 320],
    'SPS': [0.061661185336398534,
  0.0801013689376889,
  0.05507619072481045,
  0.049028134251258175,
  0.037983465702190224,
  0.02707469740986232,
  0.026345587788038922,
  0.016843625893829216],
    'OGS': [0.07496218195317002,
  0.08277644990547887,
  0.07993179382434167,
  0.04995359964446375,
  0.055880699094373876,
  0.04512128546924109,
  0.05146090806771949,
  0.049721813836977755],
    'ORDP': [0.38750704135708647,
  0.19036203623608988,
  0.0945738141499836,
  0.10806695714767924,
  0.05522664439994624,
  0.0448478100208038,
  0.022629658462141215,
  0.027034423697536163],
}

df = pd.DataFrame(data)

# 绘制数据
plt.figure(figsize=(8, 6))
plt.plot(df['Node Nums'], df['SPS'], marker='s', markersize=10, label='SPS')
plt.plot(df['Node Nums'], df['OGS'], marker='^', markersize=10, label='OGS')
plt.plot(df['Node Nums'], df['ORDP'], marker='*', markersize=10, label='ORDP')

# plt.title('Comparison of SPF and Cplex Algorithms')
plt.xlabel('Number of Nodes', fontsize=14)
plt.ylabel('Resource Utilization (%)', fontsize=14)
plt.legend(fontsize='large')  # 设置图例的字体大小为大

plt.grid(True)
# plt.show()
plt.savefig("output/ru.svg", format="svg")
